<template>
    <div>
        <el-button @click="createCamera">添加摄像头</el-button>
    </div>
</template>
<script setup lang="ts">
import { getMyProjectManager } from "@/getMyProjectManager";
const myProjectManager = getMyProjectManager()

// 封装生成随机 ID 的函数
function generateRandomId(length = 10) {
    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
    let result = '';
    for (let i = 0; i < length; i++) {
        result += characters.charAt(Math.floor(Math.random() * characters.length));
    }
    return result;
}
const createCamera = () => {
    myProjectManager.compontentManager.createCompontent({
        component: 'CameraProPerty',
        id: generateRandomId()
    })
}

</script>
<style></style>